<template>
    <div class="container">
        <div class="cart_title">
            <span class="title_main">购物车</span>
            <span class="title_check">管理</span>
        </div>
        <div class="title_space"></div>
        <div class="cart_list" v-for="(item,index) in cartList" :key="index">
            <div class="cart_list_shop">
                <img 
                    class="uncheck uncheck_shop" 
                    :src="[item.shop_checked==true?incheck_img:uncheck_img]"
                    alt=""
                    @click="handleCheckShop(index)"
                >
                <img class="shop_pic" src="../assets/cart_list/shopcart_icon_shop_wps.png" alt="">
                <span class="shop_name">{{item.shop_name}}</span>
                <img class="shop_go" src="../assets/cart_list/sdssy_xj_icon@3x.png" alt="">
            </div>
            <div v-for="(ite,idx) in item.goodsDetailsList" :key="idx">
                <div class="cart_list_com">
                <img 
                class="uncheck uncheck_com" 
                :src="[ite.is_checked==true?incheck_img:uncheck_img]" 
                alt=""
                @click="handleCheck_com(index,idx)"
                >
                <img class="com_pic" :src="ite.goods_image" alt="">
                <p class="com_name">{{ite.goods_name}}</p>
                <p class="com_value">{{ite.goods_spec_chineseValue}}</p>
            </div>
            <div class="com_nums">
                <span class="com_price">￥{{ite.goods_price}}</span>
                <div class="com_num_box">
                    <img class="com_num_min" src="../assets/cart_list/numbermins.png" alt="">
                    <span class="com_num">{{ite.goods_num}}</span>
                    <img class="com_num_plus" src="../assets/cart_list/numberplus.png" alt="">
                </div>
            </div>
            </div>
            
        </div>
        <div class="write_space"></div>
        <div class="com_settlement">
            <img class="uncheck all_checkd" src="../assets/cart_list/unchecked.png" alt="">
            <span class="allcheck_txt">全选</span>
            <span class="all_price_txt">合计</span>
            <span class="all_price">￥0.00</span>
            <div class="all_settlement">
                <span>结算</span><span>(</span><span>0</span><span>)</span>  
            </div>
        </div>
    </div>
</template>

<script>
    // import axios from 'axios'
    export default {
        data() {
            return {
                uncheck_img:require('../assets/cart_list/unchecked.png'),
                incheck_img:require('../assets/cart_list/inchecked.png')
            }
        },
        created () {
            // let url = 'https://www.fkgou.com/mallms/app/home/mobconfig/query?platForm=2';
            // let url='https://www.fkgou.com/mallms/wap/detail/goodsid/query'
            // axios.get(url).then(res=>{
            //     console.log(res);
            // })
            // axios.post(url,{platForm: 2, goodsId: 142842, token: "503b69cd-23be-4cf9-827b-990a1d6826c7"}).then(res=>{
            //     console.log(res);
            // })
        },
        computed: {
            cartList(){
                return this.$store.state.cart.cartList
            },
            cartInfo(){
                return this.$store.getters['cart/cartInfo']
                // return this.$store.getters['cart/allInfo']
            }
        },
        methods: {
            handleCheck_com(idx,index) { //一个商品的单选
                this.$store.commit('cart/CheckComMut',{
                    idx:idx,
                    index:index
                })
            },
            handleCheckShop(index){
                this.$store.commit('cart/CheckShopMut',index);
            }
        },
    }
</script>

<style src='../assets/css/cart.css' scoped>
    
</style>
<style lang="less" scoped>

</style>